<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="./zepto.1.1.6.min.js"></script>
    <title>test</title>
</head>
<body style="display: -webkit-box;">
<div class="container" style="width:850px;">
    <div class="row">
        <h5>online</h5>
        <div>activityId: <input type="text" class="activityId" value="1"> player: <input type="text" class="player" value="1"> <input type="button" id="qrcode" value="扫码"></div>
    </div>
    <div class="row">
        <h5>app</h5>
        <div>activityId: <input type="text" class="activityId" value="1"> player: <input type="text" class="player" value="1"> <input type="button" id="listen_code" value="app监听qrcode"></div>
        <div>activityId: <input type="text" class="activityId" value="1"> player: <input type="text" class="player" value="1"> <input type="button" id="begin" value="开始"></div>
        <div>activityId: <input type="text" class="activityId" value="1"> player: <input type="text" class="player" value="1"> <input type="button" id="stop" value="终止"></div>
        <div>activityId: <input type="text" class="activityId" value="1"> player: <input type="text" class="player" value="1"> <input type="button" id="getresult" value="获取信息"></div>
        <div>activityId: <input type="text" class="activityId" value="1"> player: <input type="text" class="player" value="1"> points: <input type="text" class="points" value="1"> <input type="button" id="result" value="提交信息"></div>
    </div>

    <div>
        <h5>offline</h5>
        <h6> 秒秀脚法</h6>
        <div><input type="button" id="freekick" value="check"></div>
        <h6> 火爆投篮</h6>
        <div><input type="button" id="freeShooting" value="check"></div>
        <h6> 记录我创 跑步机</h6>
        <div><input type="button" id="pbj" value="check"></div>
        <h6> 秒当主角</h6>
        <div>url: <input type="text" class="url"> <input type="button" id="never" value="提交视频"></div>
        <h6> 急速幻影</h6>
        <div>url: <input type="text" class="url"> <input type="button" id="strobo" value="提交图片"></div>

    </div>
</div>


<div id="log" style="-webkit-box-flex: 1;min-width: 400px;">
    <h3 id="end">LOG</h3>
</div>


<script>
    console.log = function (str) {
        $("<div style='white-space:nowrap;'>" + str + "</div>").insertAfter("#end");
    };

    $("#qrcode").on("click", function () {
        var self = this;
        $.ajax({
            url: "http://adidas.weixinzjit.com/index/online/setuser",
            type: "POST",
            dataType: "json",
            data: {
                "participantId": 1,
                "activityId": $(self).parent().find(".activityId").val(),
                "clientKey": "sd325SFV3sd23g2",
                "player": $(self).parent().find(".player").val(),
                "username": "手动"
            },
            success: function (data) {
                console.log(JSON.stringify(data));
            }
        });
    });

    $("#begin").on("click", function () {
        var self = this;

        $.ajax({
            url: "http://adidas.weixinzjit.com/index/app/begin",
            type: "POST",
            dataType: "json",
            data: {
                "activityId": $(self).parent().find(".activityId").val(),
                "player": $(self).parent().find(".player").val()
            },
            success: function (data) {
                console.log(JSON.stringify(data));
            }
        });
    });

    $("#stop").on("click", function () {
        var self = this;

        $.ajax({
            url: "http://adidas.weixinzjit.com/index/app/stop",
            type: "POST",
            dataType: "json",
            data: {
                "activityId": $(self).parent().find(".activityId").val(),
                "player": $(self).parent().find(".player").val()
            },
            success: function (data) {
                console.log(JSON.stringify(data));
            }
        });
    });

    $("#getresult").on("click", function () {
        var self = this;

        var timer = setInterval(function () {
            $.ajax({
                url: "http://adidas.weixinzjit.com/index/app/getresult",
                type: "POST",
                dataType: "json",
                data: {
                    "activityId": $(self).parent().find(".activityId").val(),
                    "player": $(self).parent().find(".player").val()
                },
                success: function (data) {
                    console.log(JSON.stringify(data));
                }
            });
        }, 3000);
    });

    $("#result").on("click", function () {
        var self = this;

        $.ajax({
            url: "http://adidas.weixinzjit.com/index/app/result",
            type: "POST",
            dataType: "json",
            data: {
                "activityId": $(self).parent().find(".activityId").val(),
                "player": $(self).parent().find(".player").val(),
                "points": $(self).parent().find(".points").val()
            },
            success: function (data) {
                console.log(JSON.stringify(data));
            }
        });
    });

    $("#listen_code").on("click", function () {
        var self = this;

        var timer = setInterval(function () {
            $.ajax({
                url: "http://adidas.weixinzjit.com/index/app/getqueue",
                type: "POST",
                dataType: "json",
                data: {
                    "activityId": $(self).parent().find(".activityId").val(),
                    "player": $(self).parent().find(".player").val()
                },
                success: function (data) {
                    console.log(JSON.stringify(data));
                    if (!data.errno) {
                        clearInterval(timer);
                    }
                }
            })
        }, 3000);
    });


</script>
<script>
    $("#freekick").on("click", function () {
        var timer = setInterval(function () {
            $.ajax({
                url: "http://adidas.weixinzjit.com/index/offline/FreeKick/check",
                type: "POST",
                data: {},
                success: function (data) {
                    console.log(data);
                }
            });
        }, 3000);
    });

    $("#freeShooting").on("click", function () {
        var timer = setInterval(function () {
            $.ajax({
                url: "http://adidas.weixinzjit.com/index/offline/FreeShooting/check",
                type: "POST",
                data: {},
                success: function (data) {
                    console.log(JSON.stringify(data));
                }
            });
        }, 3000);
    });

    $("#pbj").on("click", function () {
        var timer = setInterval(function () {
            $.ajax({
                url: "http://adidas.weixinzjit.com/index/offline/GuinnessWorldRecords/check",
                type: "POST",
                data: {},
                success: function (data) {
                    console.log(JSON.stringify(data));
                }
            });
        }, 3000);
    });

    $("#never").on("click", function () {
        var self = this;
        $.ajax({
            url: "http://adidas.weixinzjit.com/index/offline/NeverFollows/link",
            type: "POST",
            data: {
                url: $(self).parent().find(".url").val()
            },
            success: function (data) {
                console.log(JSON.stringify(data));
            }
        });
    });

    $("#strobo").on("click", function () {
        var self = this;
        $.ajax({
            url: "http://adidas.weixinzjit.com/index/offline/StroboPhoto/link",
            type: "POST",
            data: {
                url: $(self).parent().find(".url").val()
            },
            success: function (data) {
                console.log(JSON.stringify(data));
            }
        });
    });
</script>
</body>
</html>